<?php
/*由bean脚本生成 powerBy--joe*/
namespace app\common\validate;

use app\common\bean\StorePermissionBean;

class StorePermissionValidate extends BaseValidate
{

	static $all = 'all';
	static $add = 'add';
    static $addTop = 'add_top';
    static $addChild = 'add_child';
	static $edit = 'edit';
	static $editTop = 'edit_top';
	static $editChild = 'edit_child';
	static $pkId = 'id';

	public function __construct(array $rules = [], array $message = [], array $field = [])
	{
		parent::__construct($rules, $message, $field);
		$this->rule = [
			 StorePermissionBean::$id => 'require', //
			 StorePermissionBean::$name => 'require|max:40', //权限名称
			 StorePermissionBean::$parentId => 'require', //父级id 0为模块
			 StorePermissionBean::$model => 'require|max:40', //模块名
			 StorePermissionBean::$controller => 'require|max:40', //控制器名
			 StorePermissionBean::$action => 'require|max:40', //f方法名
			 StorePermissionBean::$icon => 'require|max:255', //图标
			 StorePermissionBean::$isPlay => 'require', //是否菜单显示 0否，1显示
			 StorePermissionBean::$sort => 'require', //排序
			 StorePermissionBean::$createdAt => 'require', //创建时间
		];
		$this->message = [
			StorePermissionBean::$id.POINST."require " => 'id必须', //
			StorePermissionBean::$name.POINST."require " => 'name必须', //权限名称
			StorePermissionBean::$parentId.POINST."require " => 'parent_id必须', //父级id 0为模块
			StorePermissionBean::$model.POINST."require " => 'model必须', //模块名
			StorePermissionBean::$controller.POINST."require " => 'controller必须', //控制器名
			StorePermissionBean::$action.POINST."require " => 'action必须', //f方法名
			StorePermissionBean::$icon.POINST."require " => 'icon必须', //图标
			StorePermissionBean::$isPlay.POINST."require " => 'is_play必须', //是否菜单显示 0否，1显示
			StorePermissionBean::$sort.POINST."require " => 'sort必须', //排序
			StorePermissionBean::$createdAt.POINST."require " => 'created_at必须', //创建时间
		];
		$this->scene = [
			self::$all => [
				StorePermissionBean::$id,
				StorePermissionBean::$name,
				StorePermissionBean::$parentId,
				StorePermissionBean::$model,
				StorePermissionBean::$controller,
				StorePermissionBean::$action,
				StorePermissionBean::$icon,
				StorePermissionBean::$isPlay,
				StorePermissionBean::$sort,
				StorePermissionBean::$createdAt,
			],
			self::$add => [
			],
            self::$addTop => [StorePermissionBean::$name,StorePermissionBean::$model],
            self::$addChild =>[StorePermissionBean::$name,StorePermissionBean::$model,StorePermissionBean::$parentId,StorePermissionBean::$controller,StorePermissionBean::$action],
			self::$edit => [
			],
            self::$editTop => [StorePermissionBean::$id,StorePermissionBean::$name,StorePermissionBean::$model],
            self::$editChild =>[StorePermissionBean::$id,StorePermissionBean::$name,StorePermissionBean::$model,StorePermissionBean::$parentId,StorePermissionBean::$controller,StorePermissionBean::$action],
            self::$pkId => [StorePermissionBean::$id,],

		];
	}


}
